module.exports = {
  propRE: /[\{|,][\s|"]*([a-zA-Z|_])+[\s|"]*(?=:)/g,
  camelCaseRE: /_([a-z])/g,
  kebabCaseRE: /([^_])([A-Z])/g,
  toCamelCaseJSON(json) {
    const self = this;
    return json.replace(self.propRE, function ($0) {
      return self.toCamelCase($0);
    });
  },
  toKebabCaseJSON(json) {
    const self = this;
    return json.replace(self.propRE, function ($0, $1) {
      return self.toKebabCase($0);
    });
  },
  toCamelCase(str) {
    const self = this;
    return str ? str.replace(self.camelCaseRE, function ($0, $1) {
      return $1.toUpperCase();
    }) : str;
  },
  toKebabCase(str) {
    const self = this;
    return str ? str.replace(self.kebabCaseRE, '$1_$2').toLowerCase() : str;
  }
};